NASA - Get APOD Object
(22 actions, 22 KB)
0 Comment
• API Documentation: https://github.com/nasa/apod-api • Astronomy Picture of the Day (APOD): https://apod.nasa.gov/apod/astropix.html
1 DataJar > GetValueIntent »
keyPath
:
API Credentials.NASA
2 Dictionary »
{ "api_key": "
[1 Value
as Dictionary.api_key
]
", "date": "
[CurrentDate
{\"WFISO8601IncludeTime\":false,\"Date Style\":\"ISO 8601\"}
]
", "thumbs": true }
3 ToolboxProForShortcuts > CreateQueryItemIntent »
dictionary
:
[2 Dictionary]
inputType
:
dictionary
4 ToolboxProForShortcuts > BuildURLIntent »
path
:
/planetary/apod
host
:
api.nasa.gov
queryItems
:
[3 Query Item]
5 Get Contents of URL
[4 URL]
»
6
8
11
14
16
ShowHeaders
:
true
6 Get Dictionary Value for
media_type
in
[5 Contents of URL
as Dictionary
]
»
7
10
7 If
[6 Dictionary Value
’s Name
]
is
image
8 Get Dictionary Value for
hdurl
in
[5 Contents of URL
as Dictionary
]
9 End If
10 If
[6 Dictionary Value
’s Name
]
is
video
11 Get Dictionary Value for
thumbnail_url
in
[5 Contents of URL
as Dictionary
]
12 End If »
13
14
13 If
[12 If Result]
has any value
14 Set Dictionary Value for
imageURL
to
[12 If Result]
in
[5 Contents of URL]
15 Otherwise
16 Set Dictionary Value for
imageURL
to
[5 Contents of URL
as Dictionary.url
]
in
[5 Contents of URL]
17 End If »
20
18 Format Date
[CurrentDate]
»
DateFormatStyle
:
Custom
DateFormat
:
yyMMdd
19 URL
https://apod.nasa.gov/apod/ap
[18 Formatted Date]
.html
»
20 Set Dictionary Value for
url
to
[19 URL]
in
[17 If Result]
»
21 Stop and Output
[20 Dictionary]